package website.seamonster.ethegg.dataobject;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import javax.persistence.*;

/**
 * Created by 罗海量
 * 2018-07-23 00:46
 */
@Entity
@Table(name = "view_chicken_farm")
@Slf4j
@Data
public class ChickenFarmView {

    private String userId;
    private Long chickenId;
    private String chickenName;
    private Integer bornNum;
    private Boolean isAlive;
    private Long eggId;
    private Integer eggStatus;

    @Id
    @Column(name = "USER_ID")
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "CHICKEN_ID")
    public Long getChickenId() {
        return chickenId;
    }

    public void setChickenId(Long chickenId) {
        this.chickenId = chickenId;
    }

    @Basic
    @Column(name = "CHICKEN_NAME")
    public String getChickenName() {
        return chickenName;
    }

    public void setChickenName(String chickenName) {
        this.chickenName = chickenName;
    }

    @Basic
    @Column(name = "BORN_NUM")
    public Integer getBornNum() {
        return bornNum;
    }

    public void setBornNum(Integer bornNum) {
        this.bornNum = bornNum;
    }

    @Basic
    @Column(name = "IS_ALIVE")
    public Boolean getIsAlive() {
        return isAlive;
    }

    public void setIsAlive(Boolean alive) {
        isAlive = alive;
    }

    @Basic
    @Column(name = "EGG_ID")
    public Long getEggId() {
        return eggId;
    }

    public void setEggId(Long eggId) {
        this.eggId = eggId;
    }

    @Basic
    @Column(name = "EGG_STATUS")
    public Integer getEggStatus() {
        return eggStatus;
    }

    public void setEggStatus(Integer eggStatus) {
        this.eggStatus = eggStatus;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ChickenFarmView that = (ChickenFarmView) o;

        if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false;
        if (chickenId != null ? !chickenId.equals(that.chickenId) : that.chickenId != null) return false;
        if (chickenName != null ? !chickenName.equals(that.chickenName) : that.chickenName != null) return false;
        if (bornNum != null ? !bornNum.equals(that.bornNum) : that.bornNum != null) return false;
        if (isAlive != null ? !isAlive.equals(that.isAlive) : that.isAlive != null) return false;
        if (eggId != null ? !eggId.equals(that.eggId) : that.eggId != null) return false;
        if (eggStatus != null ? !eggStatus.equals(that.eggStatus) : that.eggStatus != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = userId != null ? userId.hashCode() : 0;
        result = 31 * result + (chickenId != null ? chickenId.hashCode() : 0);
        result = 31 * result + (chickenName != null ? chickenName.hashCode() : 0);
        result = 31 * result + (bornNum != null ? bornNum.hashCode() : 0);
        result = 31 * result + (isAlive != null ? isAlive.hashCode() : 0);
        result = 31 * result + (eggId != null ? eggId.hashCode() : 0);
        result = 31 * result + (eggStatus != null ? eggStatus.hashCode() : 0);
        return result;
    }
}
